package com.groupbuying.provider.controller;

import com.groupbuying.provider.service.StoreAccountService;
import com.groupbuying.provider.utils.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@Api("服务商员工管理")
@RequestMapping("/staff")
@RestController
public class StoreStaffController extends BaseController {

	@Autowired
    StoreAccountService storeAccountService;


	/**
	 * 分页获取员工
	 * @param params
	 * @return
	 */
	@GetMapping()
	@ApiOperation(value = "获取员工", notes = "获取员工接口")
	public R listByPage(@RequestParam Map<String, Object> params) {
		return storeAccountService.internal_getStaffListLike(params);
	}

	/**
	 * 获取未绑定收银台的员工
	 * @param params
	 * @return
	 */
	@GetMapping("/unBangding")
	@ApiOperation(value = "获取未绑定收银台的员工", notes = "获取未绑定收银台的员工")
	public R getUnBangDing(@RequestParam Map<String, Object> params) {
		return storeAccountService.internal_getStaffList_unBangDing(params);
	}

	@PostMapping("/exits")
	@ResponseBody
	public boolean exits(@RequestParam Map<String, Object> params) {
		// 存在，不通过，false
		return !storeAccountService.exits(params);
	}
}
